public class Login {

    private String name;
    private String nums;

    public Login(String name, String nums) {
        this.name = name;
        this.nums = nums;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNums() {
        return nums;
    }

    public void setNums(String nums) {
        this.nums = nums;
    }

    @Override
    public String toString() {
        return "Login{" +
                "name='" + name + '\'' +
                ", nums='" + nums + '\'' +
                '}';
    }

    public void login(String name, String nums) {

        if(!this.name.equals(name)) {
            throw new NameWrong("用户名错误");
        }
        if(!this.nums.equals(nums)) {
            throw new NumsWrong("密码错误");
        }
        System.out.println("登陆成功");
    }
}
